home *** CD-ROM | disk | FTP | other *** search
/ Languguage OS 2 / Languguage OS II Version 10-94 (Knowledge Media)(1994).ISO / gnu / oleo-1_4.lha / oleo-1.4 / ir.h < prev    next >
C/C++ Source or Header  |  1993-03-30  |  3KB  |  98 lines

  1. /*    Copyright (C) 1992, 1993 Free Software Foundation, Inc.
  2.  
  3. This program is free software; you can redistribute it and/or modify
  4. it under the terms of the GNU General Public License as published by
  5. the Free Software Foundation; either version 2, or (at your option)
  6. any later version.
  7.  
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  11. GNU General Public License for more details.
  12.  
  13. You should have received a copy of the GNU General Public License
  14. along with this software; see the file COPYING.  If not, write to
  15. the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
  16.  
  17.  
  18. #ifndef INTRECTANGLEH
  19. #define INTRECTANGLEH
  20.  
  21. #include "proto.h"
  22. /*  t. lord    Thu Feb 13 00:44:35 1992    */
  23.  
  24. #define xx_IRllx(R)  ((R)->x)
  25. #define xx_IRlly(R)  ((R)->y)
  26. #define xx_IRurx(R)  ((R)->x + (R)->w - 1)
  27. #define xx_IRury(R)  ((R)->y + (R)->h - 1)
  28.  
  29. typedef struct xx_sIntRectangle * xx_IntRectangle;
  30. struct xx_sIntRectangle
  31. {
  32.   int x, y;
  33.   unsigned int w, h;
  34. };
  35.  
  36. #define xx_IRinit(R,X,Y,W,H)   (void)(((R)->x = (X)), ((R)->y = (Y)), \
  37.                       ((R)->w = (W)), ((R)->h = (H)))
  38. /* extern int xx_IRintersects (xx_IntRectangle, xx_IntRectangle); */
  39. #define xx_IRintersects(R1,R2) \
  40.   (xx_IRllx(R1) <= xx_IRurx(R2) &&\
  41.    xx_IRurx(R1) >= xx_IRllx(R2) &&\
  42.    xx_IRlly(R1) <= xx_IRury(R2) &&\
  43.    xx_IRury(R1) >= xx_IRlly(R2))
  44.  
  45.  
  46.  
  47. #ifdef PRETTY_PRINT_DECLS
  48. #ifdef __STDC__
  49. extern void xx_pp_intrectangle (xx_IntRectangle, FILE *);
  50. #else
  51. extern void xx_pp_intrectangle ();
  52. #endif
  53. #endif
  54.  
  55. #define xx_IRx(R) ((R)->x)
  56. #define xx_IRy(R) ((R)->y)
  57. #define xx_IRw(R) ((R)->w)
  58. #define xx_IRh(R) ((R)->h)
  59. #define xx_IRxl(R) xx_IRx(R)
  60. #define xx_IRyl(R) xx_IRy(R)
  61. #define xx_IRxh(R) (xx_IRx(R) + xx_IRw(R) - 1)
  62. #define xx_IRyh(R) (xx_IRy(R) + xx_IRh(R) - 1)
  63.  
  64. #ifdef PRETTY_PRINT
  65.  
  66. void
  67. xx_pp_intrectangle (r, stream)
  68.      xx_IntRectangle r;
  69.      FILE * stream;
  70. {
  71.   fprintf (stream, "(xx_IntRectangle x %d, y %d, w %d, h %d)",
  72.        r->x, r->y, r->w, r->h);
  73. }
  74. #endif
  75.  
  76. #ifdef __STDC__
  77. extern int xx_IRencloses (xx_IntRectangle r1, xx_IntRectangle r2);
  78. extern int xx_IRencloses_width (xx_IntRectangle r1, xx_IntRectangle r2);
  79. extern int xx_IRequiv (xx_IntRectangle r1, xx_IntRectangle r2);
  80. extern void xx_IRbound (xx_IntRectangle r1, xx_IntRectangle r2);
  81. extern int xx_IRarea (xx_IntRectangle r);
  82. extern int xx_IRhits_point (xx_IntRectangle rect, int x, int y);
  83. extern void xx_IRclip (xx_IntRectangle r1, xx_IntRectangle r2);
  84. extern int xx_IRsubtract (xx_IntRectangle outv, xx_IntRectangle a, xx_IntRectangle b);
  85.  
  86. #else
  87. extern int xx_IRencloses ();
  88. extern int xx_IRencloses_width ();
  89. extern int xx_IRequiv ();
  90. extern void xx_IRbound ();
  91. extern int xx_IRarea ();
  92. extern int xx_IRhits_point ();
  93. extern void xx_IRclip ();
  94. extern int xx_IRsubtract ();
  95.  
  96. #endif
  97. #endif
  98.